import i18n from '@/i18n'
import Vue from 'vue'

let vueI18n = new Vue({
  i18n
})

const beam = {
  state: {
    checkRules: {
      name: [
        // 请输入波束名称
        { required: true, message: vueI18n.$t('message.validate.resources.beam.name'), trigger: 'blur' }
      ]
    },
    beamOption: []
  },
  mutations: {
    setBeamOption (state, data) {
      state.beamOption = data
    }
  },
  actions: {
    async getBeamOption (context, payload) {
      let response = await context.dispatch(`axios`, {
        method: 'get',
        url: `/api/abs/resources/beams/`,
        params: {
          satellite: payload
        }
      })
      context.commit('setBeamOption', response.data)
      return 1
    }
  }
}
export default beam
